<template>
  <div>
    <el-dialog title="欠费用户" :visible.sync="dialogVisible" width="75%" >
      <div>
        <div class="table">
          <TableColumn
            ref="tabledata"
            :tableData="tableData"
            :tableConfig="tableConfig"
          >
          </TableColumn>
        </div>
      </div>
      <div slot="footer">
        <el-button @click="dialogVisible = false" size="small">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {gettabledatalistapi} from '@/api/prwpaid/cost-management/Recharge'
import TableColumn from '@/components/Table/index.vue'
import { exportexcel } from '@/utils/excel'
export default {
  name: 'CallPolicedialogqianfei',
  components: {
    TableColumn
  },
  props: {
    buildingId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      dialogVisible: false,
      tableData: [],
      tableConfig: [
        { label: '序号', type: 'index', center: 'center', width: '80' },
        { label: '建筑群名称', prop: 'buildingsName', width: '200' },
        { label: '用户名称', prop: 'customerName' },
        { label: '余额(元)', prop: 'balance', center: 'right' },
        { label: '近七日平均费用(元)', prop: 'averageAmount', center: 'right' },
        {
          label: '近七日平均用量(kWh)',
          prop: 'averageUse',
          width: '200',
          center: 'right'
        },
        { label: '预计剩余使用天数', prop: 'dayLeft' },
        { label: '余额状态', prop: 'balanceStatusName', center: 'center' },
        {
          label: '最后一次充值时间',
          prop: 'lastRechargeTime',
          center: 'center'
        },
        {
          label: '最后一次充值金额(元)',
          prop: 'lastRechargeAmount',
          center: 'right'
        }
      ],
      totalCount: '',
      pageobj: {
        pageNo: 1,
        pageSize: 500
      }
    }
  },

  mounted() {},

  methods: {
    // 获取表格数据
    async gettablelist() {
      const {
        data: { list, totalCount }
      } = await gettabledatalistapi({
        buildingId: this.buildingId,
        customerId: '',
        pageNo: this.pageobj.pageNo - 1,
        pageSize: this.pageobj.pageSize,
        type: 'ELEC',
        balanceStatus: '02'
      })
      this.tableData = list
      this.totalCount = totalCount
    },
  }
}
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__footer{
  text-align: center;
}
.table {
  height: 500px;
  margin: 10px 0;
}
</style>
